From b2ee1ced399348d0223b07f5d70459173b0e7aa3 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Fri, 5 Sep 2008 20:34:37 +0000 Subject: [PATCH] inifile: Check input file for unicode format. --- gpsbabel/inifile.c | 3 +++ gpsbabel/inifile.h | 1 + 2 files changed, 4 insertions(+) diff --git a/gpsbabel/inifile.c b/gpsbabel/inifile.c index 84ef67a79..d3b4fc923 100644 --- a/gpsbabel/inifile.c +++ b/gpsbabel/inifile.c @@ -139,10 +139,13 @@ inifile_load_file(gbfile *fin, inifile_t *inifile, const char *myname) { char *buf; inifile_section_t *sec = NULL; + int line = 0; while ((buf = gbfgetstr(fin))) { char *cin = lrtrim(buf); + + if ((line++ == 0) && fin->unicode) inifile->unicode = 1; if (*cin == '\0') continue; /* skip empty lines */ if ((*cin == '#') || (*cin == ';')) continue; /* skip comments */ diff --git a/gpsbabel/inifile.h b/gpsbabel/inifile.h index 560727732..e7fc8289f 100644 --- a/gpsbabel/inifile.h +++ b/gpsbabel/inifile.h @@ -27,6 +27,7 @@ typedef struct inifile_s { int isecs; /* number of sections */ queue secs; /* sections */ + gbuint8 unicode:1; } inifile_t; /* -- 2.30.2